<?php
class arc_errController extends accessController{
    public static function _right(){
        return array(
            array('文章挑错管理',1),
            array('文章挑错列表','mylist'),
            array('文章挑错删除','del'),
        );
    }
	public function s(){
		return array('arc_err');
	}
	
	public function mylist(){
		$type_arr=$this->s_0->pick_error_type();
		$type_arr[0]='--请选择--';
		$condition=array();
		$extra='';
		$extra_data=array();
		
		$arc_id=intval($_GET['arc_id']);//
		if($arc_id){
			$condition['arc_id']=$arc_id;
			$extra.=" and `arc_id`=:arc_id";
			$extra_data['arc_id']=$arc_id;
		}
		
		isset($_GET['type']) or $_GET['type']=0;
		$type=intval($_GET['type']);//
		if($type>0){
			$condition['type']=$type;
			$extra.=" and `type`=:type";
			$extra_data['type']=$type;
		}
		
		$ts_1=$_GET['ts_1'];//
		if($ts_1){
			$condition['ts_1']=$ts_1;
			$tmp=strtotime($ts_1);
			$extra.=" and `timestring`>=:ts_1";
			$extra_data['ts_1']=$tmp;
		}
		$ts_2=$_GET['ts_2'];//
		if($ts_2){
			$condition['ts_2']=$ts_2;
			$tmp=strtotime($ts_2);
			$extra.=" and `timestring`<=:ts_2";
			$extra_data['ts_2']=$tmp;
		}
		$return=$this->s_0->mylist($condition,$extra,$extra_data);
		include($this->viewer_dir.'arc_err/mylist.php');
	}
	//批量删除
	public function del(){
		if($_GET){
			$id=intval($_GET['id']);
			if($id>0){
				$r=$this->s_0->del($id);
				autoalert($r[0],$r[1]);
				back();
			}
		}
		if($_POST){
			$id=$_POST['items'];
			if(!empty($id)){
				foreach($id as $k=>$v) $this->s_0->del($v);
				alert('删除成功！');
				back();
			}
		}
	}
	public function bit_op(){
		
	}

//
}